TEAMNAME=Jtacck
ZIPNAME=$(TEAMNAME)_FR.zip
PDFLATEX=pdflatex
TEXS=postmortem.tex
PDFS=$(TEXS:%.tex=%.pdf)
ZIPPDFS=$(PDFS:%=$(TEAMNAME)_%)
OTHERFILES=
ZIPOTHERFILES=$(OTHERFILES:%=$(TEAMNAME)_%)

all: pdf zip slides.pdf

slides.tex: slides-header.tex
	touch $@

postmortem.tex: cuts.tex assignments.tex header.tex
	touch $@

pdf: $(PDFS)

zip: pdf
	echo $(ZIPOTHERFILES)
	ls $(PDFS) $(OTHERFILES) | xargs -I '{}' cp {} Jtacck_{}
	zip $(ZIPNAME) -m $(ZIPPDFS)

clean:
	rm -f *.aux *.log *~

cleanall: clean
	rm -f $(PDFS) $(ZIPNAME)

%.pdf: %.tex
	while (echo "R\n" | $(PDFLATEX) $^ ; \
	grep -q "Rerun to get cross" `basename $^ .tex`.log ) do true ; \
	done

.phony: pdf zip clean cleanall all